<template>
  <div :class="isSubPage ? '' : 'app-container'">
    <!-- 查询 -->
    <!-- 工具栏 -->
    <tl-list-toolbar ref="toolbar" @add="openAddDialog('editForm')" @deleteBatch="doDeleteBatch" :isDisplayAdd="!isReadOnly" :isDisplayDeleteBatch="!isReadOnly" :isDisplayExport="false" :isDisplayRight="false" :disableDeleteBatch="selectedRowKeys.length <= 0">
      <template slot="left-btn"> </template>
    </tl-list-toolbar>
    <div>
      <!-- 列表选择 -->
      <div class="table-alert-div" ref="selector">
        <el-alert type="success" :closable="false" class="tl-table-alert-info" effect="light">
          <template slot="title">
            已选择&nbsp;<a class="tl-table-alert-info-a1">{{ selectedRowKeys.length }}</a
            >项&nbsp;&nbsp;
            <a class="tl-table-alert-info-a2" @click="doClearSelected">全部清空</a>
          </template>
        </el-alert>
      </div>
      <!--表格渲染-->
      <el-table class="tl-table" ref="mainTable" :height="isSubPage ? '300px' : tableHeight" resizable-key="tableHeight" :resizable-refs="tableResizeRefs" v-loading="loading" :data="datas" @selection-change="doSelectChange" @sort-change="doSortChange" @row-dblclick="doRowDbClick" @row-click="doRowClick" row-key="id" border fit :row-class-name="doChangeRowClassName">
        <el-table-column type="selection" width="55px" fixed="left"></el-table-column>
        <el-table-column type="index" label="序号" width="55px" align="center"></el-table-column>
        <el-table-column prop="name" label="会议议题" width="150px" sortable="custom" sort-by="name" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="reportusername" label="汇报人姓名" width="100px" sortable="custom" sort-by="reportusername" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="reportbegintime" label="汇报开始时间" width="170px" sortable="custom" sort-by="reportbegintime" align="center" header-align="center" :formatter="dateTimeFormat" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="reportminutes" label="汇报时长(分钟)" width="150px" sortable="custom" sort-by="reportminutes" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="preparematerial" label="汇报内容"  sortable="custom" sort-by="preparematerial" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column label="操作" width="110px" v-slot="scope" fixed="right">
          <el-dropdown trigger="hover">
            <el-button type="text" icon="el-icon-s-operation" style="margin-left:10px">更多<i class="el-icon-arrow-down el-icon--right"></i></el-button>
            <el-dropdown-menu>
              <el-dropdown-item  v-if="isReadOnly === false" icon="el-icon-edit" @click.native="openEditDialog('editForm', scope.row.id)">编辑</el-dropdown-item>
              <el-dropdown-item  v-if="isReadOnly === false" icon="el-icon-delete" @click.native="doDelete(scope.row.id)">删除</el-dropdown-item>
              <el-dropdown-item icon="el-icon-view" @click.native="openViewDialog('editForm', scope.row.id)">查看</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </el-table-column>
      </el-table>
      <!-- 列表分页 -->
      <el-row class="pagebar" ref="pager">
        <el-pagination @size-change="doChangeSize" @current-change="doChangeIndex" :current-page="pageInfo.currentPage" :page-sizes="pageInfo.pageSizes" :total="pageInfo.totalCount" layout="total, sizes, prev, pager, next, jumper" background class="tl-table-pagination"> </el-pagination>
      </el-row>
      <tl-edit ref="editForm" :tempUsersParam="usersParam" @refresh="doRefresh" :isFromMenu="!isSubPage" :sourceMeetID="sourceMeetID" :meetBegintime="meetBegintime" :meetEndtime="meetEndtime"></tl-edit>
    </div>
  </div>
</template>

<script>
/** mixins */
import { mixin_list } from '@tapui/mixins/mixin_list'
/** 子组件 */
import tlEdit from './edit'
/** 工具类 */
import { getAction, putAction, postAction, deleteAction } from '@tapui/utils/http'
export default {
  name: 'meetAgenda',
  mixins: [mixin_list],
  components: { tlEdit },
  data() {
    return {
      description: '会议议程-列表查询',
      urlPrefix: '/meet/agenda/',
      url: {
        // queryCodeList: '/meet/agenda/dataCodeList'
      },
      // 排序参数
      sorterInfo: {
        sidx: 'sortcode',
        sord: 'asc'
      },
      usersParam: {}
    }
  },
  props: {
    isSubPage: {
      type: Boolean,
      default: false
    },
    sourceMeetID: {
      type: [Number, String],
      default: ""
    },
    isReadOnly: {
      type: Boolean,
      default: false
    },
    meetBegintime: {
      type: String,
      default: ""
    },
    meetEndtime: {
      type: String,
      default: ""
    },
    tempUsersParam: {
      type: Object,
      default: function() {
        return {}
      }
    }
  },
  watch: {
    tempUsersParam: {
      deep: true,
      handler(newValue, oldValue) {
        this.setUsersParam(newValue)
      }
    }
  },
  methods: {
    /** 加载数据之前 */
    beforeLoadData() {
      if (this.isSubPage) {
        this.queryParam.qry_meetid = this.sourceMeetID
      } else {
        if (!this.queryParam.qry_meetid) {
          this.$tap.alert("请选择所属会议", "warning")
          return false
        }
      }
      return true
    },
    // 设置画面模式（edit/view）
    setDblClickActionType(mode) {
      this.rowDbClickActionType = mode
    },
    setUsersParam(val) {
      this.usersParam = val
    }
  },
  mounted() {
    this.setUsersParam(this.tempUsersParam)
  }
}
</script>

<style scoped></style>
